<?php if (!defined('THINK_PATH')) exit();?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no" />
    <title>我的课程-老师上门</title>
    <link rel="stylesheet" href="/lssm/Public/mobile/css/public.css">
    <link rel="stylesheet" href="/lssm/Public/mobile/css/fenlei.css">
    <link rel="stylesheet" href="/lssm/Public/mobile/css/index.css">
    <link rel="stylesheet" href="/lssm/Public/mobile/css/user.css">

    <link href="/lssm/Public/css/layui.css" rel="stylesheet" type="text/css" media="all"/>
    <script type="text/javascript" src="/lssm/Public/layui.js"></script>

    <script type="text/javascript" src="/lssm/Public/mobile/js/jquery-1.8.3.min.js"></script>

</head>
<body>
<div id="page" class="showpage">
    <!-- 顶部导航及筛选start -->
    <header>
      <div class="tab_nav">
        <div class="header">
          <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>
          <div class="h-mid">课程签到</div>
        </div>
      </div>
      </header>
    <!-- 顶部导航及筛选end -->
    <div style="font-size: 12px;padding: 10px;">
        <form class="layui-form" style="background: #fff;border: 1px solid #DCDADA;height: 190px;">
          <div class="layui-form-item" style="padding-top: 5px;margin-bottom: 2px;margin-left: -10px;">
              <label class="layui-form-label">开始日期</label>
              <div class="layui-input-inline" style="width: 120px;margin-bottom: 0px;">
                  <input class="layui-input" type="text" name="start" lay-verify="start" placeholder="本次授课日期" id="LAY_demorange_s">
              </div>
          </div>
          <div class="layui-form-item" style="margin-bottom: 2px;margin-left: -10px;">
              <label class="layui-form-label">授课课时</label>
              <div class="layui-input-inline" style="width: 120px;margin-bottom: 0px;">
                  <select name="sk_num">
                      <option value="1">1课时</option>
                      <option value="2">2课时</option>
                      <option value="3">3课时</option>
                  </select>
              </div>
              <!-- <div class="layui-form-mid layui-word-aux">本次授课课时数</div> -->
          </div>
          <div class="layui-form-item" style="margin-bottom: 2px;margin-left: -10px;">
              <label class="layui-form-label">授课总结</label>
              <div class="layui-input-inline" style="margin-bottom: 0px;">
                  <textarea name="zongjie" lay-verify="zongjie" cols="28" rows="4" placeholder="请老师精简的对本次授课作出总结"></textarea> 
              </div>
          </div>
          <div class="layui-form-item" style="margin-left: -10px;">
              <label for="L_repass" class="layui-form-label"></label>
              <input type="hidden" name="kec_id" value="<?php echo ($id); ?>">
              <button  class="layui-btn" lay-filter="add" lay-submit="" style="font-size: 8px;background: #30C76C;">授课签到</button>
          </div>
        </form>
    </div>

    <!-- 老师列表start -->
    <section class="hots bortn"> 
       <div class="ui-refresh"> 
        <div id="data-list">
        <?php foreach ($signs as $v) { ?>
          <dl>
           <dd class="dd-l"> 
              <strong class="t-name">授课时间：<?php echo date('Y-m-d H:i',$v['addtime']) ?><i></i></strong>
              <!-- <span class="t-pingjia">课时：<?php echo ($v["keshi"]); ?></span> -->
              <p class="t-tag">授课课时：<?php echo ($v["keshi"]); ?></p>
              <p class="t-tag">老师总结：<?php echo ($v["zongjie"]); ?></p>
              <p class="t-tag">家长评论：<?php echo ($v["comment"]); ?></p>
              <p class="t-pingjia">
              <?php if ($v['jz_qd'] == 1) { ?>
                  <span style="padding: 8px;background: #30C76C;color: #fff;border-radius: 20px;">家长已签到</span>
              <?php }else { ?>
                  <span style="padding: 8px;background: #FF6000;color: #fff;border-radius: 20px;">家长未签到</span>
                  <a title="短信通知" href="javascript:;" onclick="jz_tongz(this,'<?php echo ($v["id"]); ?>')" style="text-align: center;">短信通知</a>
              <?php } ?></p>
           </dd>                                                    
          </dl> 
        <?php } ?>      
        </div> 
       </div> 
    </section>
    <!-- 老师列表end -->

</div>
  <script>
      layui.use(['form','layer','laydate'], function(){
          $ = layui.jquery;
          laydate = layui.laydate;//日期插件
        var form = layui.form()
        ,layer = layui.layer;


        var start = {
          min: '2017-01-01 23:59:59'
          ,max: '2099-06-16 23:59:59'
          ,istoday: false
          ,choose: function(datas){
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
          }
        };
        document.getElementById('LAY_demorange_s').onclick = function(){
          start.elem = this;
          laydate(start);
        }

        //自定义验证规则
        form.verify({
          start: function(value){
            if(value.length < 1){
              return '请选择本次授课日期';
            }
          }
          ,zongjie: function(value){
            if(value.length < 1){
              return '请老师用不超过100的文字对本次授课作出总结';
            }
          }
        });

        //监听提交
        form.on('submit(add)', function(data){
          //console.log(data);
          //发异步，把数据提交给php
          $.ajax({
              url: "<?php echo U('mobile/info/qiandaozj');?>",//请求地址
              type: "post",//请求方式
              dataType: "json",//返回数据类型
              data: data.field,//发送的参数
              })
              .done(function(response) {
                    if(response.error==0){
                       layer.msg(response.info ,{icon:5});

                    }else{
                       layer.msg(response.info ,{icon:6});
                       location.reload();
                    }
                })
              .fail(function() {
                  alert("ajxs交互失败");
              })  

          return false;
        });
                     
      });

      /*通知*/
      function jz_tongz(obj,id){
          layer.confirm('确认要发短信通知吗？',function(index){
              //发异步删除数据
              id = id;
              $.ajax({
                  url: "<?php echo U('mobile/info/tongzjz');?>",//请求地址
                  type: "post",//请求方式
                  dataType: "json",//返回数据类型
                  data: {id:id},//发送的参数
                  })
                  .done(function(response) {
                        if(response.error==1){
                          layer.msg(response.info ,{icon:6});
                        }else{
                          layer.msg(response.info ,{icon:5});
                        }
                    })
                  .fail(function() {
                      alert("ajxs交互失败");
                  })  
              return false;
          });
      }
  </script>
</body>
</html>